package chapter05

/**
  * @Copyright: Shanghai Definesys Company.All rights reserved.
  * @Description:
  * @author: chuhaitao
  * @since: 2019/1/1 21:01
  * @history:
  *          1.2019/1/1 created by chuhaitao
  */
object FunctionDemo2 {

  def main(args: Array[String]): Unit = {
  //  print(getResult(1, 3, '='))
    test(4)
  }


  def getResult(n1: Int, n2: Int, n3: Char) = {
    if (n3.==('=')) {
      n1 + n2
    } else {
      n1 - n2
    }
  }

  def  test(n:Int): Unit ={
    if(n>2){
      test(n-1)
    }
    print(n)
  }
}
